import axios from 'axios';

// var basicUrl = location.protocol + '//' + location.host + ':3000';
var basicUrl = 'http://218.244.145.83:3000'
const api = {

    getBanner(){
        
        return axios.get(`${basicUrl}/banner?type=1`)
    },

    getJinPingList(){
        return axios.get(`${basicUrl}/top/playlist/highquality?limit=6`);
    },

    // 获取歌曲详情 可以是多首
    getSongInfo(ids){
        return axios.get(`${basicUrl}/song/detail?ids=${ids}`)
    },

    getLyric(id){
        return axios.get(`${basicUrl}/lyric?id=${id}`)
    },

    // 新歌速递
    getNewSongs(){
        return axios.get(`${basicUrl}/top/song?type=0`);
    },

    // 新碟上架 （最新专辑）
    getNewAlbum(offset=0, limit=6){
        return axios.get(`${basicUrl}/top/album?offset=${offset}&limit=${limit}`);
    },

    // 专辑详情
    getAlbumDetail(){

    },

    getRecommendList(limit = 6){
        return axios.get(`${basicUrl}/personalized?limit=${limit}`)
    },

    search(keyword, limit=30, offset=0){
        return axios.get(`${basicUrl}/search?keywords=${keyword}&limit=${limit}&offset=${offset}`)
    },

    songsDetail(id) {
        return axios.get(`${basicUrl}/playlist/detail?id=${id}`)
    },

    getHotSearch(){
        return axios.get(`${basicUrl}/search/hot`)
    },

    getHotSearchDeatail(){
        return axios.get(`${basicUrl}/search/hot/detail`)
    },

    getSearchSuggest(params){
        return axios.get(`${basicUrl}/search/suggest?keywords=${params}&type=mobile`)
    },

    getMusicUrl(id){
        return axios.get(`${basicUrl}/song/url?id=${id}`)
    },

    searchSinger(type){
        return axios.get(`${basicUrl}/toplist/artist?type=${type}`)
    },

    getSingerDetail(id){
        return axios.get(`${basicUrl}/artist/detail?id=${id}`)
    },

    getSongsBySingerId(id) {
        return axios.get(`${basicUrl}/artists?id=${id}`)
    },

    getAblumsBySingerId(id){
        return axios.get(`${basicUrl}/artist/album?id=${id}`)
    },

    getAlbumList(id){
        return axios.get(`${basicUrl}/album?id=${id}`)
    },

    getVideosBySingerId(id){
        return axios.get(`${basicUrl}/artist/mv?id=${id}`)
    },

    getMvSrc(id){
        return axios.get(`${basicUrl}/mv/url?id=${id}`)
    }
}


export default api;